from coin.exchange.base.kr_rest.py_product import PyProduct
from coin.exchange.base.kr_rest.product_info import (
    ProductInfo, ProductHolder, ProductInfoConstant)
from coin.exchange.okex_v5.kr_rest.constants import pi_file


okex_spot_product_info = ProductInfoConstant(pi_file)

def get_holder_from_product(product):
  if isinstance(product, PyProduct):
    assert product.market_name == 'Spot' and product.exchange_name == 'Okex'
  product_info = okex_spot_product_info.get_product_info(product.relative_norm)
  return ProductHolder(product, product_info)
